package com.world.rickcloudendpoint.demo;

/**
 * @description:
 * @author: jlsong
 * @date: 2022/06/04 04:43:58
 * @version: 1.0
 */
public enum DataTypeEnum {
    One(1, "one"),
    Two(2, "two"),
    Three(3, "three"),
    Four(4, "four"),
    Five(5, "five"),
    Six(6, "six"),
    Seven(7, "seven"),
    Eight(8, "eight"),
    ;

    private int code;
    private String name;

    DataTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public DataTypeEnum fromCode(int code) {
        DataTypeEnum[] dataTypeEnums = DataTypeEnum.values();
        for (DataTypeEnum d : dataTypeEnums) {
            if (d.code == code) {
                return d;
            }
        }
        return null;
    }
}
